package com.mtsmda.jsInJava;

import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

public class JS {

	public static void main(String[] args) {

		ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
		ScriptEngine scriptEngine = scriptEngineManager
				.getEngineByName("JavaScript");
		scriptEngine.put("name", "Dmitrii");
		try {
			scriptEngine.eval("print('Hello, '+ name + '!')");
		} catch (ScriptException e) {
			e.printStackTrace();
		}

	}

}